home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000172_icon-group-sender_Mon Dec 18 09:24:39 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id eBIGNQY01007
  4.     for icon-group-addresses; Mon, 18 Dec 2000 09:23:26 -0700 (MST)
  5. Message-Id: <200012181623.eBIGNQY01007@baskerville.CS.Arizona.EDU>
  6. Date: Fri, 15 Dec 2000 17:26:13 -0700
  7. From: Steve Wampler <swampler@noao.edu>
  8. To: John Sampson <jsampson@indexes.u-net.com>
  9. Cc: icon-group@cs.arizona.edu
  10. Subject: Re: Stepping
  11. Content-Disposition: inline
  12. User-Agent: Mutt/1.1.9i
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15. Content-Length: 1424
  16.  
  17. On Fri, Dec 15, 2000 at 08:12:26PM -0000, John Sampson wrote:
  18. > It would be useful to be able to step through an Icon program or set
  19. > break-points in some simple way. I would have thought
  20. > dummy := read()
  21. > would be useful, and indeed it does step, but dummy remains null so one
  22. > cannot use it to leave the program at will. If dummy acquired a value from
  23. > read(), as the book leads me to expect, I could write
  24. > if dummy == "q" then stop
  25. > I don't understand why dummy is null - is cessation of keyboard input deemed
  26. > to be EOF, thus causing the procedure to fail?
  27. > Regards
  28. > _John Sampson_
  29.  
  30. Try this instead:
  31.  
  32.     read() | stop("Aborted on user command")
  33.  
  34. now an EOF character will terminate the program and an ENTER will allow the
  35. program to continue.
  36.  
  37. In fact, make it a procedure:
  38.  
  39. procedure pauseForUser()
  40.     writes("Enter EOF character to abort program, ENTER to continue: ")
  41.     input := read() | stop("Terminated by user.")
  42. #
  43. #  Now you can put any special processing here (say to turn tracing
  44. #    on or off, or print a "stack" dump, or whatever.)!
  45. #
  46.     return input
  47. end
  48.  
  49. However, dummy := read() sure should assign a value to dummy if you've
  50. typed anything other than EOF.  Are you sure you're not confusing
  51. null with an empty string (what you'll see if you just press ENTER)?
  52.  
  53. Hope this helps!
  54. Steve
  55.  
  56. --
  57. Steve Wampler-  SOLIS Project, National Solar Observatory
  58. swampler@noao.edu
  59.